<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let notRequired = ['(', ')', '{', '}', '+', '*', '/', '\'']
    let str = `fooBar() {
                return this.foo + ' ' + this.bar * this.name / this.age
            }`
    let result = str.replace(/[\r\n ]/g, '')
    result = result.split('')
    result = result.filter(item => !notRequired.includes(item))
    result = result.join('')
    result = result.split('return')
    result = result[1]
    result = result.split('this.').filter(Boolean)
    console.log(result);
</script>
</body>
</html>
